package com.promise.jokerdream.ui.settings

import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import com.promise.jokerdream.ui.components.SettingCard
import com.promise.jokerdream.ui.components.CheckboxOptionRow
import com.promise.jokerdream.ui.theme.AppSpacing
import com.promise.jokerdream.ui.theme.AppFontSizes
import com.promise.jokerdream.database.entity.WulinGameConfigEntity
import com.promise.jokerdream.config.game.WulinRegistrationType

/**
 * 武林大会设置卡片
 */
@Composable
fun WulinSettingCard(
    config: WulinGameConfigEntity,
    onWulinChange: (Boolean) -> Unit,
    onRegistrationTypeChange: (WulinRegistrationType) -> Unit,
    modifier: Modifier = Modifier,
    onExecuteClick: (() -> Unit)? = null
) {
    SettingCard(
        title = "武林大会",
        description = "",
        checked = config.enabledSetting,
        onCheckedChange = onWulinChange,
        modifier = modifier,
        onExecuteClick = onExecuteClick,
        content = {
            if (config.enabledSetting) {
                Row(
                    modifier = Modifier.fillMaxWidth(),
                    horizontalArrangement = Arrangement.SpaceBetween
                ) {
                    // 电脑报名选项
                    CheckboxOptionRow(
                        title = "电脑报名",
                        checked = config.registrationType == "COMPUTER",
                        onCheckedChange = { 
                            if (it) {
                                onRegistrationTypeChange(WulinRegistrationType.COMPUTER)
                            }
                        },
                        modifier = Modifier.weight(1f)
                    )
                    
                    // 手机报名选项
                    CheckboxOptionRow(
                        title = "手机报名",
                        checked = config.registrationType == "MOBILE",
                        onCheckedChange = { 
                            if (it) {
                                onRegistrationTypeChange(WulinRegistrationType.MOBILE)
                            }
                        },
                        modifier = Modifier.weight(1f)
                    )
                }
            }
        }
    )
}
